/*
 * Daniel R Padilla
 *
 * Copyright (c) 2008, Daniel R Padilla
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA  02110-1301  USA
 */
package org.databasefacade.util;

import java.util.HashMap;
import java.util.Iterator;

import org.w3c.dom.NodeList;

public class XMLDataRecord {
	private NodeList childNodes;
	private String name;
	private String value;
	private HashMap attributes=new HashMap();
	public void setAttribute(String name, String value) {
		attributes.put(name, value);
	}
	public void setName(String name) {
		this.name=name;
	}
	public String getName() {
		return name;
	}
	public void setValue(String value) {
		this.value=value;
	}
	public String getValue() {
		return value;
	}
	public Iterator getAttributeNames() {
		return attributes.entrySet().iterator();
	}
	public String getAttributeValue(String name) {
		return (String) attributes.get(name);
	}
	public void setChildNodes(NodeList nodes) {
		this.childNodes=nodes;
	}
	public NodeList getChildNodes() {
		return this.childNodes;
	}
	
	public String toString() {
		String data = "Name: " + name + "\n" +
			   		"Value: " + value;
		Iterator keys = attributes.keySet().iterator();
		while (keys.hasNext()) {
			String key = keys.next().toString();
			String keyValue = (String) attributes.get(key);
			data = data + "\n" + "AttributeName: " + key +", AttributeValue: " +keyValue;
		}
		return data;
	}
}
